package com.example.a2032.db.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.example.a2032.entity.RealTimeData;
import com.example.a2032.entity.SleepData;

import java.util.List;

@Dao
public interface RealTimeStepDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(RealTimeData realTimeData);

    @Query("select * from realtimedata")
    LiveData<RealTimeData> loadAllRealTime();

    @Query("select * from realtimedata where date = :date")
    LiveData<RealTimeData> loadLastRealTimeStep(String date);

    @Query("select * from realtimedata where date = :date")
    RealTimeData getLastRealTimeStep(String date);

    @Query("select * from realtimedata where date >= :lastUploadDate ORDER BY date DESC")
    List<RealTimeData> getLastPPGData(String lastUploadDate);
}
